<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in">
      <div class="cornerComment-in-title">
        <span>{{ cornerDetail ? cornerDetail.name + '-' : '' }}今日预约班级</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-table
            ref="multipleTable"
            :data="arryList"
            border
            tooltip-effect="dark"
            style="width: 100%"
            @row-click="rowClick"
            header-cell-class-name="table-text-c"
            cell-class-name="table-text-c">
          <el-table-column width="100"  align="center" label="ID">
            <template slot-scope="scope">
              <el-radio v-model="radio" :label="scope.row.id" class="radioCheckBox">{{ scope.row.id }}</el-radio>
            </template>
          </el-table-column>
          <el-table-column
              prop="class_name"
              label="班级名称"
              align="center">
          </el-table-column>
          <el-table-column
              prop="name"
              label="状态"
              align="center">
            <template slot-scope="scope">
              {{ scope.row.start_time ? '计时中' : '' }}
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click.native="closePOpup" size="small">取消</el-button>
        <el-button size="small" type="primary" @click="checkEditFn">开始计时</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {cornerTimeClass} from "@/api/admin/corner"

export default {
  props: ['visible', 'cornerDetail'], // recruitmentType examine 审核
  components: {},
  data() {
    return {
      dialogVisible: false,
      arryList: [],
      radio: '',
    }
  },
  watch: {
    visible() {
      console.log('this.visible:', this.visible)
      this.dialogVisible = this.visible
      if (this.visible) {
        this.initFn()
      }
    }
  },
  created() {

  },
  methods: {
    initFn() {
      console.log('this.cornerDetail:', this.cornerDetail)
      cornerTimeClass({corner_id: this.cornerDetail.corner_id}).then(res => {
        if (!res.code) {
          console.log(res)
          this.arryList = res.list
        }
      })
    },
    checkEditFn() {
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    // 行选中
    rowClick(option) {
      this.applyBookBox = option.name
      this.radio = option.id
      this.applyBox = option
    },
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 700px;
  height: 500px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.resruitment-title {
  padding: 5px 0;
  border-bottom: 2px solid #abd3f3;
  margin-bottom: 20px;
}

.el-radio {
  margin-right: 20px;
}

.jobTime {
  display: flex;
  align-items: center;
}

.jobTime span {
  padding: 0 10px;
}
</style>


